<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>科室信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <base href="<%=url%>">
    <script src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://lib.baomitu.com/layui/2.6.5/layui.min.js"></script>
    <link href="https://lib.baomitu.com/layui/2.6.5/css/layui.min.css" rel="stylesheet">
    <style>
    </style>
</head>
<body>
<div class="layui-main">
    <blockquote class="layui-elem-quote">预约挂号信息</blockquote>
    <table id="tbl" lay-filter="tbl"></table>
    <script type="text/html" id="tbl-toolbar">

    </script>
</div>
<script>
    layui.use(['jquery', 'table', 'layer', 'form'], function () {
        var $ = layui.$;
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        table.render({
            elem: '#tbl',
            url: '/examine/res',
            method: 'get',
            initSort: { //排序
                field: 'account' //排序字段，对应 cols 设定的各字段名
                , type: 'asc' //排序方式  asc: 升序、desc: 降序、null: 默认排序
            },
            cols: [[
                {field: 'uname', title: '患者名称', width: 95},
                {field: 'name', title: '医生', width: 85},
                {field: 'ksname', title: '科室', width: 150},
                {field: 'visitdate', title: '就医时间',
                    templet: "<div>{{layui.util.toDateString(d.visitdate, 'yyyy-MM-dd')}}</div>", width: 110},
                {field: 'aptdate', title: '预约时间',
                    templet: "<div>{{layui.util.toDateString(d.aptdate, 'yyyy-MM-dd')}}</div>", width: 110},
                {field: 'schedule', title: '预约早中晚', width: 150},
                {field: 'Notes', title: '备注', width: 90},
                {field: 'state', title: '医治',
                    templet: function (row){
                        if (row.state==0){
                            return "未就医";
                        }else if(row.state==1){
                            return "就医中";
                        }else if (row.state==2){
                            return "已就医";
                        }
                    }, width: 90},
                {field: 'inspect', title: '体检',
                    templet: function (row){
                        if (row.inspect==0){
                            return "未办理体检";
                        }else if(row.inspect==1){
                            return "已办理体检";
                        }
                    }, width: 150},
            ]],
            page: {
                limit: 5,//指定每页显示的条数
                limits: [5, 10, 20, 40, 50, 60, 80, 100]//每页条数的选中
            }//开启分页

            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据，res为从url中get到的数据
                var result;
                if (this.page.curr) {
                    result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
                } else {
                    result = res.data.slice(0, this.limit);
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.count, //解析数据长度
                    "data": result //解析数据列表
                };
            },
            // 表格容器id，用于表格重载
            id: 'tbl'
        });
    })
</script>
</body>
</html>